<?php 
session_start();
if (isset($_POST['name'])){ 
	$name=trim(addslashes($_POST['name']));
	$phone=trim(addslashes($_POST['phone']));
	$sheng=trim(addslashes($_POST['sheng']));
	$shi=trim(addslashes($_POST['shi']));
	$jia=trim(addslashes($_POST['jia']));
	$ishui=trim(addslashes($_POST['ishui']));
	
	
	
	include_once("../c/config.php");
	$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
	
	
	if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
	$openid=$_SESSION['openid'];
	$query=$mysqli->query("select id from userinfo where openid='".$openid."' limit 0, 1");
	if($query->num_rows>0){
	    //$mysqli->query("update userinfo set name='".$name."',lianxi='".$lianxi."',shenfen='".$shenfen."' where openid='".$openid."' "); 
	}else{
	    $mysqli->query("insert into userinfo(jia,ishui,openid,name,phone,sheng,shi,createtime) values('".$jia."','".$ishui."','".$openid."','".$name."','".$phone."','".$sheng."','".$shi."','".date("Y-m-d H:i:s")."') ");
	}
	 
	echo json_encode(array('status'=>'ok'));
}
?>